import Vue from 'vue'
import App from './App.vue'
import Router from 'vue-router'
import router from './router'

import store from './store'
import axios from 'axios'
import qs from 'qs'
import '../plugins/vant'

import NProgress from 'nprogress'
// import BScroll from 'better-scroll'
// import 'nprogress/nprogress.css'
// eslint-disable-next-line no-unused-vars
import VueAwesomeSwiper from 'vue-awesome-swiper'
// import 'swiper/dist/css/swiper.css'
axios.interceptors.request.use(function (config) {
  NProgress.start()
  return config
})

// axios 响应拦截
axios.interceptors.response.use(function (response) {
  NProgress.done()
  return response
})

const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.config.productionTip = false
Vue.use(qs)
Vue.use(VueAwesomeSwiper /* { default global options } */)
// Vue.use(VueAwesomeSwiper)

Vue.prototype.$http = axios

const vm = new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
export default vm
